import React from 'react';
import { inject } from 'mobx-react';
import { getEcCom, getAntd } from '../../../util/convert';
import Content from './Content';
import { WeaPopoverHrm } from 'ecCom';
import { WeaLocaleProvider } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;
@inject('ensureSubmitStore')
export default class Main extends React.Component {

  getButtons() {
    const { Button } = getAntd();
    let buttons = [
    <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@clsmcg@confirm`} type='primary' onClick={this.confirm}>{getLabel(382958,'确定')}</Button>,
    <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@g2o1lv@cancel`} type='primary' onClick={this.cancel}>{getLabel(31129,'取消')}</Button>
    ] 
    return buttons;
  }

  confirm = () => {
    const { ensureSubmitStore: {confirmEvent }} = this.props;
    confirmEvent();
  } 

  cancel = () => {
    const { ensureSubmitStore } = this.props;
    ensureSubmitStore.cancelEvent();
  }
  render() {
    const { WeaDialog } = getEcCom();
    const { visible, promptInfo } = this.props;
    return (
      <WeaPopoverHrm ecId={`${this && this.props && this.props.ecId || ''}_WeaPopoverHrm@g9w5ql`}>
         <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@zoh2co`}
          visible={visible}
          title={getLabel(513004, '信息确认')}
          icon='icon-coms02-Warning'
          iconBgcolor='#F2A945'
          onCancel={() => {this.cancel()}}
          buttons={this.getButtons()}
          style={{width:"400px"}}
          className={'ensure-submit-dialog'}
      >
        <Content ecId={`${this && this.props && this.props.ecId || ''}_Content@6k0tgy`} promptInfo={promptInfo}/>
      </WeaDialog>
      
      </WeaPopoverHrm>
     
    )
  }
}